package dfsketches.gas;

import java.util.Arrays;

public class GasTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int w = 11;
		int h = 11;
		int d = 11;
		
		boolean[][][] pathes = new boolean[w][h][d];
		for (int x = 0; x < w; x++) {
			for (int y = 0; y < h; y++) {
				Arrays.fill(pathes[5][y], true);
			}
		}
		GasMap gm = new PrimitiveGasMap(pathes);
		
		GasProcessor gp = new PrimitiveGasProcessor(gm);
		for (int step = 0; step < 100; step++) {
			printMap(5, gm);
			gp.process();
			gm.setConcentration(1, 5, 5, 5, 1000);
			gm.setConcentration(1, 5, 3, 3, 1000);
			gm.setConcentration(1, 5, 7, 7, 1000);
		}
	}
	
	private static void printMap(int x, GasMap gm) {
		int w = gm.getWidth();
		int h = gm.getHeight();
		int d = gm.getDepth();
		for (int y = 0; y < h; y++) {
			for (int z = 0; z < d; z++) {
				int c = gm.getConcentration(1, x, y, z);
				if (c == 0)
					System.out.print(' ');
				else if (c < 10)
					System.out.print('.');
				else if (c < 20)
					System.out.print('*');
				else if (c < 30)
					System.out.print('0');
				else 
					System.out.print('@');
//				System.out.print(c + " ");
			}
			System.out.println();
		}
		System.out.println("===================");
	}

}